//
//  EskBarPlot.h
//  Display the bar chart that allow user tab on the bar. 
//  The chart will use the highlight color and dash line border for
//  the selected chart.
//
//  Created by Ken Wong on 8/7/11.
//  Copyright 2011 Essence Work LLC. All rights reserved.
//

/*
 Status: changed
 Last Merge Date: 05-29-2012
 Last Change Date: 
 Changes:
 1. current amount animation
 2. add tempIncreaseValue and tempReduceValue
 */

#import <Foundation/Foundation.h>
#import "CorePlot-CocoaTouch.h"
#import "Balance.h"

@protocol EskBarPlotDelegate;

@interface EskBarPlot : NSObject <CPTPlotDataSource, CPTBarPlotDelegate>
{
  @private
    CPTGraph *graph;
    CPTBarPlot *barPlot;
    CPTBarPlot *selectedPlot;
    NSUInteger selectedBarIndex;
    NSNumberFormatter *currencyFormatter;
    NSUInteger selectedLineIndex;
    NSUInteger numberOfPeriods;
    Balance *selectedDailyBalance;
    BOOL displayCurrentBalance;
    NSArray *agingLabelsNoCurrentAmount;
    NSArray *agingLabelsWithCurrentAmount;
    Balance *newDailyBalance;
    Balance *oldDailyBalance;
    NSUInteger timerCount;
    NSTimer *dataTimer;
    NSTimer *currentBalanceTimer;
    NSInteger startingUndueAmount;
    Balance *switchDailyBalance;
    BOOL tempReduceValue;
    BOOL tempIncreaseValue;
    NSString *asOfDateString;
   
}

@property (nonatomic, assign) id<EskBarPlotDelegate> delegate;
//@property (nonatomic, retain) NSArray *agingData;
@property (nonatomic, retain) NSArray *agingLabels;
@property (nonatomic, retain) NSMutableDictionary *dailyBalances;
@property (nonatomic, retain) NSArray *dailyKeys;


// Render the chart on the hosting view from the view controller with the default theme.
- (void)renderInLayer:(CPTGraphHostingView *)layerHostingView withTheme:(CPTTheme *)theme;
//- (void)barPlot:(EskBarPlot *)plot respondToLinePlotSelectedAtRecordIndex:(NSUInteger)index;
- (void)barPlot:(EskBarPlot *)plot respondToLinePlotSelectedAtDate:(NSString *)selectedDateString;
- (void)barPlot:(EskBarPlot *)plot respondToCurrentBalanceSwitch:(BOOL)switchOn;
- (void)rescaleTheBarPlot;
@end

// Bar Plot delegate to notify when the bar is selected.
@protocol EskBarPlotDelegate <NSObject>

- (void)barPlot:(EskBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index currentBalanceDisplayed:(BOOL)switchOn;


@end
